#!/usr/bin/python
import os, sets, re, common_util
#import lfc
#from threading import Thread, Lock
#from Queue import Queue, Empty

def get_se_info(sehost, vo):

    info = {}
    info[sehost] = {'paths':[], 'protocols':[]}

    cmd = 'lcg-info --vo %s --list-se --attrs \'Path,Protocol\' --query \'SE=%s\' --sed' % (vo, sehost)

    (rc, output) = common_util.exec_cmd(cmd, dryrun=False, max_trial=1) 

    # the command execution is ok   
    if (not rc) and output:
        (se, paths, protocols) = output[0].split('%')
        info[se]['paths']     = paths.split('&')
        info[se]['protocols'] = protocols.split('&')

    return info
